<!DOCTYPE html>
<html>
<head>
	<#include "/common/head.html" />
</head>
<body id="jQUi" class="cssfont">
	<div class="layout">
		<div id="content">
			<div id="list" class="panel fade in" data-load="pageListLoad" data-unload="pageListUnload" data-scroll="pageListScroll" style="display: block;">
				<#include "/common/header.html" />		
				<div class="ui-header-com">
					<div class="details-nav">
						<span class="view goback" aria-hidden="true" data-icon=""></span>
						<div class="panel-title">${rank.name!}</div>
					</div>
				</div>
				<div class="ui-body choiceness">
					<div class="cho-list fix" id="list-content">
					<#list action.getGames(rid).list as g>
						<div class="items fix">
							<span href="${basePath!}/detail/index?gid=${g.game_id!}" class="view channel-video-pic">
								<img rel="fun-5" src="${g.icon_path!}" style="background-image: url(${g.icon_path!});">
							</span>
							<div class="items-name">
								<span class="view" href="">${g.game_name!}</span>
							<!-- 
								<span class="position-r"><b class="f30">8</b><b class="f22">.8</b></span>
							-->
							</div>
							<div class="minute">
								<span class="field26">点击量</span>
								<span class="split"></span>
								<span class="type">${g.click_num!}</span>
							</div>
						</div>
					</#list>
				</div>
			<!-- 检索，精选 end -->
			</div>
			<div class="ui-body choiceness">
				<div class="clear"></div>
				<div class="list-more" id="list-more-root">
					<div class="ui-icon-loading spin"></div>
					<span class="load" id="list-more" href="###">加载更多...</span>
					<span class="end">没有更多内容了...</span>
				</div>
			</div>
		<#include "/common/footer.html" />
		</div>
	</div>
	</div>
	<script type="text/javascript">
		var curPageNo = 1;
		$("#list-more").bind("click",function(){
			$(this).html("正在加载,请稍候...");
			curPageNo+=1;
			var html = 
				"<div class='items fix'>" + 
					"<span href='#detail#' class='view channel-video-pic'>" + 
					"<img rel='fun-5' src='#iconPath#'>"+
					"</span>"+
					"<div class='items-name'>"+
						"<span class='view' href='#detail#'>#gameName#</span>"+
					"</div>"+
					"<div class='minute'>"+
						"<span class='field26'>点击量</span>"+
						"<span class='split'></span>"+
						"<span class='type'>#clickNum#</span>" +
					"</div>" +
				"</div>";
			$.post(
				"${basePath!}/site/ajax/getMoreGames",
				{rid : ${rid!} , p : curPageNo},
				function(data){
					//如果没有记录
					if(data.msg=="none"){
						$("#list-more").empty();
						$("#list-more").html("没有更多了噢！ :D");
						$("#list-more").unbind();	//解除click绑定
						return;
					}
					for(var num in data){
						var game = html;
						game=game.replace(new RegExp("#detail#","g"),"${basePath!}/detail/index?gid=" + data[num].game_id);
						game=game.replace("#iconPath#",data[num].icon_path);
						game=game.replace("#gameName#",data[num].game_name);
						//game=game.replace("#firstGrade#",data[num].grade);
						//game=game.replace("#secondGrade#",data[num].visitNum);
						game=game.replace("#clickNum#",data[num].click_num);
						$("#list-content").append(game);
					}
					if(data.length == 9){
						$("#list-more").empty();
						$("#list-more").html("加载更多...");
					}else{
						$("#list-more").empty();
						$("#list-more").html("没有更多了噢！ :D");
						$("#list-more").unbind();	//解除click绑定
					}
					$(".channel-video-pic").bind('click', function(e){
						var href = $(this).attr("href");
						window.location.href=href;
					});
			},"json");
		});
	</script>
</body></html>